
import deleteBatchItems from './deleteBatchItems'

let items = [];

let config = require('../../util/config').config

export default function deleteFile(key,type) {

    let arr=[];
    arr = JSON.parse(sessionStorage.getItem("getFile"))

    if(type==config.file){
        type = "file"
    }
    else if(type==config.article){
        type = "article"
    }else {
        type = "folder-f"
    }

    items.push({
        FILE_ID:key,
        FILE_TYPE:type
    });

    let status = deleteBatchItems(items)

    if(status=="ok"){
        let arr2=[];
        arr2 = arr.filter(item => item.moduleId != key)
        alert(arr2.length)
        sessionStorage.setItem("getFile",JSON.stringify(arr2))
    }
}


